/*
 */

package jas.http.server;

import java.io.IOException;
import java.net.BindException;
import java.net.ServerSocket;

/**
 *
 *
 */
public class HttpSeverSocketFactoryImpl implements HttpServerSocketFactory {

    public ServerSocket createSocket(int port) throws IOException {
        ServerSocket socket = null;
        int portNum = 0;
        while (socket == null && portNum < 100) {
            try {
                socket = new ServerSocket(port + portNum);
            } catch (BindException ex) {
                socket = null;
                portNum++;
            }
        }
        return socket;
    }
    
}
